package com.example.developdemo.dto;

import lombok.*;

import java.util.Map;

/**
 * 统一响应消息的封装
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@RequiredArgsConstructor
@ToString
public class Result {
    private int code =0;//响应状态码

    private String msg = "ok";//响应消息

    @NonNull
    private Object data;//响应数据

    public static Result ok() {
        return new Result();
    }

    public static Result ok(Page booksPage) {
        return new Result(booksPage);
    }

    public static Result ok(Map<String, String> map) {
        return new Result(map);
    }
}
